Skip to content

AO3-7182 Hide restricted works from guests on prompts page#5685

Open
luis-pabon-tf wants to merge 11 commits intootwcode:masterfrom
luis-pabon-tf:AO3-7182
Open

AO3-7182 Hide restricted works from guests on prompts page#5685
luis-pabon-tf wants to merge 11 commits intootwcode:masterfrom
luis-pabon-tf:AO3-7182

Conversation

@luis-pabon-tf
Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7182

Purpose

Fixes a visibility bug on the meme prompt page.

Credit

Luis Pabon (they/he)

Copy link
Copy Markdown
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Luis -- it's great to see you again!

Thank you for working on this, and I'm sorry we didn't see your comment on the issue asking for clarification about the intended behavior. We'd like the existence of these restricted works completely hidden from guests, the same way we hide restricted works on, e.g., tag work pages.

What that means is:

  1. If the only fills for a prompt are restricted, the "Fulfilled By" listbox should not be displayed.
  2. If there are both public and restricted fills for a prompt, the "Fulfilled By" listbox should be present, but only list the public works.

If you could make that change, we'd appreciate it!

@luis-pabon-tf
Copy link
Copy Markdown
Contributor Author

If you could make that change, we'd appreciate it!

Thanks for the review! just made the change and am awaiting the automatic testing to verify it.

@luis-pabon-tf luis-pabon-tf requested a review from sarken April 12, 2026 22:49
Copy link
Copy Markdown
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could also add a feature test, that would be great -- thank you!

Comment thread app/models/challenge_claim.rb Outdated
CollectionItem.user_approval_statuses[:approved], CollectionItem.collection_approval_statuses[:approved])
}

scope :fulfilled_unrestricted, -> { fulfilled.where("works.restricted = 0") }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not include the fulfilled scope and instead make it something we can chain onto it:

  # TODO: AO3-6024 for making sure we also exclude works hidden by admin
  scope :work_visible_to_all, -> { where("works.restricted = 0") }

Comment thread app/models/prompt.rb Outdated
Comment on lines +212 to +214
def fulfilled_unrestricted_claims
self.request_claims.fulfilled_unrestricted
end
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can update this to use our chained scopes and also give it a name that's a little clearer (right now, it sounds like the claim rather than the fill is unrestricted):

def fulfilled_claims_visible_to_all
  self.request_claims.fulfilled.work_visible_to_all
end


<% # if prompt has been fulfilled list works %>
<% unless prompt.unfulfilled? %>
<% unless prompt.unfulfilled? || (guest? && prompt.fulfilled_unrestricted_claims.count < 1) %>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can avoid a count here and do prompt.fulfilled_claims_visible_to_all.empty?

luis-pabon-tf and others added 2 commits April 22, 2026 11:35
Co-Authored-By: sarken <907055+sarken@users.noreply.github.com>
Co-Authored-By: sarken <907055+sarken@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good! All we need now is a test.

@luis-pabon-tf
Copy link
Copy Markdown
Contributor Author

The code looks good! All we need now is a test.

Thanks for checking it! I just finished testing the new testand am awaiting the Github version of it to run.

Copy link
Copy Markdown
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple nitpicks, but otherwise it looks good-- thanks!

Comment on lines +607 to +608
And I go to "Battle 12" collection's page
And I follow "Prompts ("
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use When I view prompts for "Battle 12" in place of these two steps.

And I press "Post"
And I go to "Battle 12" collection's page
And I follow "Prompts ("
Then I should see "Fulfilled By"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be extra thorough and also check for the work with And I should see "Restricted Fill" (and do the opposite at the end, with And I should not see "Restricted Fill")

Comment on lines +600 to +606
When I am logged in as "myname1"
When I sign up for Battle 12
When I am logged in as "myname2"
And I claim a prompt from "Battle 12"
And I start to fulfill my claim with "Restricted Fill"
And I lock the work
And I press "Post"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These setup steps can all be And steps under the Given

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants